 <!DOCTYPE html>
 <html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    li{
      width: 30px;
      height: 30px;
      background-color: pink;
       margin: 5px;
       cursor: pointer;
    }
  </style>
 </head>
 <body>
  <ul>
  <li>1</li>
  <li>2</li>
  <li>3</li>
  <button disabled>jin</button>
</ul>
<script>
  let num =0
  let liele = document.querySelectorAll('li')
  let button = document.querySelector("button")
  liele.forEach(function(ele,index){
  ele.onclick=foo
  function foo(){
    
    num+1
  }
    console.log('limian',num);
  })
 console.log('waim',num);
  
</script>
 </body>
 </html>